From: Florian Müllner Date: Wed, 8 Nov 2023 18:41:18 +0000 (+0100) Subject: status/volume: Always look up device objects X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~287 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7a04d92bc04e8add1b46b5da53239e53398ae958;p=gnome-shell.git status/volume: Always look up device objects Gvc may clean its device cache after we set up the device menu, which can lead to failed assertions when using the "old" object to later switch the device from a callback. Make sure this doesn't happen by looking up the ID again from the callback. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7173 Part-of: --- diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 7c9b14b93..c9abb4fca 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -138,7 +138,13 @@ const StreamSlider = GObject.registerClass({ ? `${description} – ${origin}` : description; const item = new PopupMenu.PopupImageMenuItem(name, device.get_gicon()); - item.connect('activate', () => this._activateDevice(device)); + item.connect('activate', () => { + const dev = this._lookupDevice(id); + if (dev) + this._activateDevice(dev); + else + console.warn(`Trying to activate invalid device ${id}`); + }); this._deviceSection.addMenuItem(item); this._deviceItems.set(id, item);